include .env
NAMESPACE?=bi-starrocks
OPERATOR_VERSION?=1.9.10
export

.PHONY: operator build push config install_uat template_uat install_d1m
prepare:
	-kubectl create ns ${NAMESPACE}
	-helm repo add starrocks https://starrocks.github.io/starrocks-kubernetes-operator
	-helm show values starrocks/kube-starrocks --version ${OPERATOR_VERSION} > test.yaml

operator:
	helm upgrade --install -f resources/operator.yaml starrocks-operator starrocks/operator -n ${NAMESPACE} \
		--set starrocksOperator.image.tag=v${OPERATOR_VERSION} \
		--version ${OPERATOR_VERSION}

template_shared_nothing_cluster:
	-mkdir -p build
	helm template starrocks-shared-nothing-cluster -f deploy/shared_nothing_cluster.yaml starrocks/kube-starrocks \
		--set starrocksOperator.image.tag=v${OPERATOR_VERSION} \
		--set starrocks.initPassword.enabled=true \
		--set starrocks.initPassword.password=${ROOT_PASSWORD} \
		--version ${OPERATOR_VERSION} -n ${NAMESPACE} > build/shared_nothing_cluster_template.yaml

install_shared_nothing_cluster:
	helm upgrade --install -f deploy/shared_nothing_cluster.yaml starrocks-shared-nothing-cluster starrocks/kube-starrocks -n ${NAMESPACE}
		--set starrocksOperator.image.tag=v${OPERATOR_VERSION} \
		--version ${OPERATOR_VERSION}

uninstall_shared_nothing_cluster:
	helm uninstall -n ${NAMESPACE} starrocks-shared-nothing-cluster
